<!-- <%-  %> 表示以html形式解析 -->
<%- include('./layout/header.ejs') %> 

<h2>文章列表</h2>
<div class="list-group">
    <% articleAll.forEach( item => { %>
      <a href="#" class="list-group-item"><%= item.title %>
        <span class="badge" style="background-color: #5bc0dc">发表时间: <%= item.ctime%></span>
        <span class="badge" style="background-color: #f0ad4e">作者昵称: <%= item.nickname %></span>
      </a>
    <% }) %>
</div>

<% if(islogin) { %>
    <nav aria-label="Page navigation">
      <ul class="pagination">
        <li class="<%= nowPage == 1 ? 'disabled' : ''%>">
          <<%= nowPage == 1 ? 'span' : 'a' %> href="?page=<%= (nowPage - 1) < 1 ? 1 : (nowPage - 1)%>" aria-label="Previous">
            <span aria-hidden="true">&laquo;</span>
          </<%= nowPage == 1 ? 'span' : 'a' %>>
        </li>
        <% for(var i = 0; i < totalPage; i++) { %>
           <li class="<%= nowPage === (i+1) ? 'active' : '' %>"><a href="?page=<%= (i+1)%>"><%= i+1 %></a></li>
        <% } %>
        <li class="<%= nowPage == totalPage ? 'disabled' : ''%>">
          <<%= nowPage == totalPage ? 'span' : 'a' %> href="?page=<%= (nowPage + 1) > totalPage ? totalPage : (nowPage + 1)%>" aria-label="Next">
            <span aria-hidden="true">&raquo;</span>
          </<%= nowPage == totalPage ? 'span' : 'a' %>>
        </li>
      </ul>
    </nav> 
<% } %>    


<%- include('./layout/footer.ejs') %>

    